3.8.8 \(\int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx\) [708]

Optimal. Leaf size=96 \[ -\frac {(A+3 i B) c^2 x}{a}-\frac {(i A-3 B) c^2 \log (\cos (e+f x))}{a f}-\frac {2 (A+i B) c^2}{a f (i-\tan (e+f x))}+\frac {i B c^2 \tan (e+f x)}{a f} \]

[Out]

-(A+3*I*B)*c^2*x/a-(I*A-3*B)*c^2*ln(cos(f*x+e))/a/f-2*(A+I*B)*c^2/a/f/(I-tan(f*x+e))+I*B*c^2*tan(f*x+e)/a/f

________________________________________________________________________________________

Rubi [A]
time = 0.11, antiderivative size = 96, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.049, Rules used = {3669, 78} \begin {gather*} -\frac {2 c^2 (A+i B)}{a f (-\tan (e+f x)+i)}-\frac {c^2 (-3 B+i A) \log (\cos (e+f x))}{a f}-\frac {c^2 x (A+3 i B)}{a}+\frac {i B c^2 \tan (e+f x)}{a f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2)/(a + I*a*Tan[e + f*x]),x]

[Out]

-(((A + (3*I)*B)*c^2*x)/a) - ((I*A - 3*B)*c^2*Log[Cos[e + f*x]])/(a*f) - (2*(A + I*B)*c^2)/(a*f*(I - Tan[e + f
*x])) + (I*B*c^2*Tan[e + f*x])/(a*f)

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\frac {(a c) \text {Subst}\left (\int \frac {(A+B x) (c-i c x)}{(a+i a x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left (\frac {i B c}{a^2}-\frac {2 (A+i B) c}{a^2 (-i+x)^2}+\frac {i (A+3 i B) c}{a^2 (-i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {(A+3 i B) c^2 x}{a}-\frac {(i A-3 B) c^2 \log (\cos (e+f x))}{a f}-\frac {2 (A+i B) c^2}{a f (i-\tan (e+f x))}+\frac {i B c^2 \tan (e+f x)}{a f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 1.75, size = 184, normalized size = 1.92 \begin {gather*} \frac {c^2 (\cos (f x)+i \sin (f x)) \left (-2 (A+3 i B) \text {ArcTan}(\tan (f x)) (\cos (e)+i \sin (e))+(-i A+3 B) \log \left (\cos ^2(e+f x)\right ) (\cos (e)+i \sin (e))+2 (A+i B) \cos (2 f x) (i \cos (e)+\sin (e))+2 (A+i B) (\cos (e)-i \sin (e)) \sin (2 f x)-2 B \sec (e+f x) \sin (f x) (-i+\tan (e))\right ) (A+B \tan (e+f x))}{2 f (A \cos (e+f x)+B \sin (e+f x)) (a+i a \tan (e+f x))} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2)/(a + I*a*Tan[e + f*x]),x]

[Out]

(c^2*(Cos[f*x] + I*Sin[f*x])*(-2*(A + (3*I)*B)*ArcTan[Tan[f*x]]*(Cos[e] + I*Sin[e]) + ((-I)*A + 3*B)*Log[Cos[e
 + f*x]^2]*(Cos[e] + I*Sin[e]) + 2*(A + I*B)*Cos[2*f*x]*(I*Cos[e] + Sin[e]) + 2*(A + I*B)*(Cos[e] - I*Sin[e])*
Sin[2*f*x] - 2*B*Sec[e + f*x]*Sin[f*x]*(-I + Tan[e]))*(A + B*Tan[e + f*x]))/(2*f*(A*Cos[e + f*x] + B*Sin[e + f
*x])*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Maple [A]
time = 0.23, size = 62, normalized size = 0.65

method result size
derivativedivides \(\frac {c^{2} \left (i B \tan \left (f x +e \right )-\frac {-2 i B -2 A}{-i+\tan \left (f x +e \right )}+\left (i A -3 B \right ) \ln \left (-i+\tan \left (f x +e \right )\right )\right )}{f a}\) \(62\)
default \(\frac {c^{2} \left (i B \tan \left (f x +e \right )-\frac {-2 i B -2 A}{-i+\tan \left (f x +e \right )}+\left (i A -3 B \right ) \ln \left (-i+\tan \left (f x +e \right )\right )\right )}{f a}\) \(62\)
norman \(\frac {\frac {\left (3 i c^{2} B +2 A \,c^{2}\right ) \tan \left (f x +e \right )}{a f}+\frac {i c^{2} B \left (\tan ^{3}\left (f x +e \right )\right )}{a f}-\frac {\left (3 i c^{2} B +A \,c^{2}\right ) x}{a}-\frac {-2 i A \,c^{2}+2 B \,c^{2}}{a f}-\frac {\left (3 i c^{2} B +A \,c^{2}\right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{a}}{1+\tan ^{2}\left (f x +e \right )}-\frac {\left (-i A \,c^{2}+3 B \,c^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 a f}\) \(165\)
risch \(-\frac {c^{2} {\mathrm e}^{-2 i \left (f x +e \right )} B}{a f}+\frac {i c^{2} {\mathrm e}^{-2 i \left (f x +e \right )} A}{a f}-\frac {6 i c^{2} B x}{a}-\frac {2 c^{2} A x}{a}-\frac {6 i c^{2} B e}{a f}-\frac {2 c^{2} A e}{a f}-\frac {2 c^{2} B}{f a \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {3 c^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B}{a f}-\frac {i c^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A}{a f}\) \(167\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*c^2/a*(I*B*tan(f*x+e)-(-2*I*B-2*A)/(-I+tan(f*x+e))+(I*A-3*B)*ln(-I+tan(f*x+e)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 4.47, size = 160, normalized size = 1.67 \begin {gather*} -\frac {2 \, {\left (A + 3 i \, B\right )} c^{2} f x e^{\left (4 i \, f x + 4 i \, e\right )} - {\left (i \, A - B\right )} c^{2} + {\left (2 \, {\left (A + 3 i \, B\right )} c^{2} f x - {\left (i \, A - 3 \, B\right )} c^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - {\left ({\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

-(2*(A + 3*I*B)*c^2*f*x*e^(4*I*f*x + 4*I*e) - (I*A - B)*c^2 + (2*(A + 3*I*B)*c^2*f*x - (I*A - 3*B)*c^2)*e^(2*I
*f*x + 2*I*e) - ((-I*A + 3*B)*c^2*e^(4*I*f*x + 4*I*e) + (-I*A + 3*B)*c^2*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x +
 2*I*e) + 1))/(a*f*e^(4*I*f*x + 4*I*e) + a*f*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [A]
time = 0.38, size = 194, normalized size = 2.02 \begin {gather*} - \frac {2 B c^{2}}{a f e^{2 i e} e^{2 i f x} + a f} + \begin {cases} \frac {\left (i A c^{2} - B c^{2}\right ) e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {- 2 A c^{2} - 6 i B c^{2}}{a} + \frac {\left (- 2 A c^{2} e^{2 i e} + 2 A c^{2} - 6 i B c^{2} e^{2 i e} + 2 i B c^{2}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {i c^{2} \left (A + 3 i B\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac {x \left (- 2 A c^{2} - 6 i B c^{2}\right )}{a} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**2/(a+I*a*tan(f*x+e)),x)

[Out]

-2*B*c**2/(a*f*exp(2*I*e)*exp(2*I*f*x) + a*f) + Piecewise(((I*A*c**2 - B*c**2)*exp(-2*I*e)*exp(-2*I*f*x)/(a*f)
, Ne(a*f*exp(2*I*e), 0)), (x*(-(-2*A*c**2 - 6*I*B*c**2)/a + (-2*A*c**2*exp(2*I*e) + 2*A*c**2 - 6*I*B*c**2*exp(
2*I*e) + 2*I*B*c**2)*exp(-2*I*e)/a), True)) - I*c**2*(A + 3*I*B)*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f) + x*(-2
*A*c**2 - 6*I*B*c**2)/a

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 283 vs. \(2 (87) = 174\).
time = 0.64, size = 283, normalized size = 2.95 \begin {gather*} \frac {\frac {{\left (-i \, A c^{2} + 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a} + \frac {2 \, {\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a} - \frac {{\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a} - \frac {-i \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i \, A c^{2} - 3 \, B c^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )} a} - \frac {3 i \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 9 \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 22 i \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 i \, A c^{2} + 9 \, B c^{2}}{a {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{2}}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

((-I*A*c^2 + 3*B*c^2)*log(tan(1/2*f*x + 1/2*e) + 1)/a + 2*(I*A*c^2 - 3*B*c^2)*log(tan(1/2*f*x + 1/2*e) - I)/a
- (I*A*c^2 - 3*B*c^2)*log(tan(1/2*f*x + 1/2*e) - 1)/a - (-I*A*c^2*tan(1/2*f*x + 1/2*e)^2 + 3*B*c^2*tan(1/2*f*x
 + 1/2*e)^2 + 2*I*B*c^2*tan(1/2*f*x + 1/2*e) + I*A*c^2 - 3*B*c^2)/((tan(1/2*f*x + 1/2*e)^2 - 1)*a) - (3*I*A*c^
2*tan(1/2*f*x + 1/2*e)^2 - 9*B*c^2*tan(1/2*f*x + 1/2*e)^2 + 10*A*c^2*tan(1/2*f*x + 1/2*e) + 22*I*B*c^2*tan(1/2
*f*x + 1/2*e) - 3*I*A*c^2 + 9*B*c^2)/(a*(tan(1/2*f*x + 1/2*e) - I)^2))/f

________________________________________________________________________________________

Mupad [B]
time = 8.57, size = 110, normalized size = 1.15 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-\frac {3\,B\,c^2}{a}+\frac {A\,c^2\,1{}\mathrm {i}}{a}\right )}{f}+\frac {\frac {\left (A\,c^2-B\,c^2\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}+\frac {\left (A\,c^2+B\,c^2\,3{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}+\frac {B\,c^2\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}{a\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*tan(e + f*x))*(c - c*tan(e + f*x)*1i)^2)/(a + a*tan(e + f*x)*1i),x)

[Out]

(log(tan(e + f*x) - 1i)*((A*c^2*1i)/a - (3*B*c^2)/a))/f + (((A*c^2 - B*c^2*1i)*1i)/a + ((A*c^2 + B*c^2*3i)*1i)
/a)/(f*(tan(e + f*x)*1i + 1)) + (B*c^2*tan(e + f*x)*1i)/(a*f)

________________________________________________________________________________________